package com.huangjue.backend.service.impl;

import com.huangjue.backend.entity.Demo;
import com.huangjue.backend.mapper.DemoMapper;
import com.huangjue.backend.service.DemoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;

@Service
public class DemoServiceImpl implements DemoService {
    @Autowired
    private DemoMapper demoMapper;

    @Override
    public List<Demo> getDemosByCourseId(Integer courseId) {
        return demoMapper.selectDemosByCourseId(courseId);
    }

    @Override
    public int getDemosNum(Integer courseId) {
        return demoMapper.getDemosNum(courseId);
    }

    @Override
    public Integer getCourseIdByDemoId(Integer demoId) {
        return demoMapper.getCourseIdByDemoId(demoId);
    }
    
    @Override
    public int updateCourseFinished(Integer userId, Integer courseId) {
        return demoMapper.updateCourseFinished(userId, courseId);
    }

    @Override
    public Integer updateOpenNum(Integer demoNum, Integer userId, Integer courseId) {
        return demoMapper.updateOpenNum(demoNum,userId,courseId);
    }
} 